#include<stdio.h>
#include<map>
using namespace std;
map<int,int> h;
long long f[100009],cnt=0;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    scanf("%d",&n);
    while(n--){
        int r;
        scanf("%d",&r);
        h[r]++;
    }
    for(auto it:h) f[++cnt] = it.second;
    int pos = 1;
    int temp = 0;
    for(int i = 2;i<=cnt;){
        if(!temp) temp = f[i];
        if(temp>f[pos]) f[pos] = 0,temp -= f[pos],pos++;
        else f[pos] -= temp,i++,temp=0;
        if(pos==i) i++,temp=0;
    }
    long long ans = 0;
    for(int i  = pos;i<=cnt;i++){
        ans += f[i];
    }
    printf("%lld",ans);
}
